package tables

import (
	"github.com/astaxie/beego/orm"
)

type Tokens struct {
	Id    int
	Uid   *Users `orm:"pk; reverse(one)"`
	Token string `orm:"size(50)"`
}

func (t *Tokens) TableName() string {
	return "tokens"
}

func (t *Tokens) GetByUid(uid int) (Tokens) {
	o, token := orm.NewOrm(), Tokens{Id: uid}
	o.Read(&token)
	return token
}